<template>
  <!-- 指标集：上中下结构 -->
  <el-row>
    <el-col v-for="(item, i) in cardList" :key="i" :span="cardSpan">
      <div class="grid-item">
        <div class="grid-item-icon">
          <cjui-icon :icon="item.icon" :size="20"></cjui-icon>
        </div>

        <div class="grid-item-value">
          {{ item.value }}
        </div>

        <div class="grid-item-label">
          {{ item.label }}
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script lang="ts" setup>
interface CardItem {
  icon?: string
  label: string
  value: string | number
  unit?: string
}

interface Props {
  cardSpan?: number
  cardList: CardItem[]
}

withDefaults(defineProps<Props>(), {
  cardSpan: 8,
  cardList: () => [],
})
</script>

<style lang="scss" scoped>
.grid-item {
  font-family: electronicFont;
  text-align: center;
  margin: 10px;
}

.grid-item-icon {
  width: 70px;
  height: 70px;
  background: url('/imgs/business/visual-dark/circle-8.png');
  background-size: 100%;
  margin: 0 auto 2px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.grid-item-value {
  font-size: 22px;
  margin-bottom: 2px;
}

.grid-item-label {
  color: #909399;
  font-size: 13px;
}
</style>
